package cn.wen.xframe;

import java.util.Date;

import org.apache.commons.lang.time.DateFormatUtils;

import cn.wen.bases.framework.struts.action.ActionSupport;
import cn.wen.bases.framework.struts.action.model.BaseModel;
import cn.wen.javax.security.IUser;

public class IndexAction extends ActionSupport {

    private IndexModel model = new IndexModel();

    @Override
    public Object getModel() {
	return model;
    }

    @Override
    public String execute() throws Exception {
	return super.execute();
    }

    private IUser user;

    public IUser getUser() {
	return user;
    }

    public void setLoginUser(IUser user) {
	this.user = user;
    }

}

class IndexModel extends BaseModel {

    private Date date = new Date();

    /**
     * @return 年
     */
    public String getYear() {
	return DateFormatUtils.format(date, "yyyy");
    }

    /**
     * @return 月
     */
    public String getMonth() {
	return DateFormatUtils.format(date, "M");
    }

    /**
     * @return 日
     */
    public String getDay() {
	return DateFormatUtils.format(date, "d");
    }

    /**
     * @return 周
     */
    public String getWeek() {
	return DateFormatUtils.format(date, "EEE");
    }
}
